using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class TargetMap : EntityTypeConfiguration<Target>
    {
        public TargetMap()
        {
            // Primary Key
            this.HasKey(t => t.Target_ID);

            // Properties
            this.Property(t => t.Target_Name)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.patient_id)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.label)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("Target");
            this.Property(t => t.Target_ID).HasColumnName("Target_ID");
            this.Property(t => t.Target_Name).HasColumnName("Target_Name");
            this.Property(t => t.Start_Time).HasColumnName("Start_Time");
            this.Property(t => t.End_Time).HasColumnName("End_Time");
            this.Property(t => t.patient_id).HasColumnName("patient_id");
            this.Property(t => t.follow_up_id).HasColumnName("follow_up_id");
            this.Property(t => t.Create_Time).HasColumnName("Create_Time");
            this.Property(t => t.Update_Time).HasColumnName("Update_Time");
            this.Property(t => t.Ljsc).HasColumnName("Ljsc");
            this.Property(t => t.label).HasColumnName("label");
        }
    }
}
